#include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#define int long long 
unordered_map<string, int> h;
vector<char> a;
vector<string> ret;
string temp;
int k = 1;
void dfs(int x) {
    if(temp.size() > 0 && temp.size() <= 6) {
        h[temp] = k++;
        ret.push_back(temp);
    }
    if(x >= 26 || temp.size() > 6) {
        return ;
    }
    for(int i = x; i < 26; i++) {
        temp.push_back(a[i]);
        dfs(i + 1);
        temp.pop_back();
    }
}
signed main() {
    string s;
    cin >> s;
    for(int i = 0; i < 26; i++) {
        a.push_back(i + 'a');
    }
    dfs(0);
    sort(ret.begin(), ret.end(), [](string& x, string&y) {
        if(x.size() != y.size()) {
            return x.size() < y.size();
        }else {
            for(int i = 0; i < x.size(); i++) {
                if(x[i] != y[i]) {
                    return x[i] < y[i];
                }
            }
        }
    });
    auto it = find(ret.begin(), ret.end(), s);
    if(it != ret.end()) {
        cout << it - ret.begin() + 1<< endl;
    }else {
        cout << 0 << endl;
    }
    return 0;
}